<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <ul>
        <!-- v-for可以接受第二个参数index，就是索引 -->
        <!-- for in 循环也可以写成 for of 循环 -->
        <li v-for="(item, index) of items">{{ item.message }} - {{ index }}</li>
      </ul>

      <ul>
        <!-- 循环对象的时候有三个参数，value, key, index -->
        <li v-for="(value, key, index) in object">
          {{ value }} - {{ key }} - {{ index }}
        </li>
      </ul>
    </div>

    <script src="../../Vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          items: [{ message: "Foo" }, { message: "Bar" }],
          object: {
            title: "How to do lists in Vue",
            author: "Jane Doe",
            publishedAt: "2016-04-10",
          },
        },
      });
    </script>
  </body>
</html>
